package org.minos.edit.view
{
	import flash.events.Event;
	import org.minos.edit.EditFacate;
	import org.minos.edit.model.AssetsProxy;
	import org.minos.edit.view.components.InfoPane;
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.mediator.Mediator;
	
	/**
	 * ...
	 * @author Minos
	 */
	public class InfoPaneMediator extends Mediator
	{
		public static const NAME : String = "InfoPaneMediator";
		
		public function InfoPaneMediator( v : InfoPane )
		{
			super( NAME , v );
		}
		
		public function get info() : InfoPane
		{
			return viewComponent as InfoPane;
		}
		
		override public function onRegister() : void
		{
			super.onRegister();
			info.getPathBtn().addActionListener( __onPathClick );
			info.getMusicBtn().addActionListener( __onMusicClick );
		}
		
		override public function onRemove() : void
		{
			super.onRemove();
			info.getPathBtn().removeActionListener( __onPathClick );
			info.getMusicBtn().removeActionListener( __onMusicClick );
		}
		
		override public function listNotificationInterests() : Array
		{
			return [ EditFacate.ENABLED ];
		}
		
		override public function handleNotification( notification : INotification ) : void
		{
			super.handleNotification( notification );
		}
		
		private function __onPathClick( e : Event ) : void
		{
			sendNotification( EditFacate.SELECT_PATH , { tf: info.getPathTf() } );
		}
		
		private function __onMusicClick( e : Event ) : void
		{
			sendNotification( EditFacate.SELECT_FILE , { tf: info.getMusicTf() } , AssetsProxy.SOUND );
		}
	
	}

}